using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Common.Pool
{
    public class GameObjPoolObj<T> : PoolObject<T> where T : UnityEngine.Object
    {
        GameObject target;
        public GameObjPoolObj(T target) : base(target)
        {
            this.target = Target as UnityEngine.GameObject;
        }
        public override PoolObject<T> Clone()
        {
            var clonetarget = GameObject.Instantiate(Target, Vector3.zero, Quaternion.identity);
            return new GameObjPoolObj<T>(clonetarget);
        }
        public override void OnSpawn()
        {
            target.SetActive(true);
            target.transform.localScale = Vector3.one;
        }
        public override void OnRecycle()
        {
            target.SetActive(false);
        }
        public override void OnDestory()
        {
            GameObject.Destroy(Target);
        }

    }
}

